<div class="eventschedule" style="padding-left:5px"><?=$this->title;?></div>
<?php
$url = url('agenda/index');
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
    'name' => 'event',
    'flat' => true,
    'language' => lang(),
    'options' => array(
        'showAnim' => 'fold',
        'changeMonth' => true,
        'changeYear' => true,
        'gotoCurrent' => true,
        'dateFormat' => "dd-mm-yy",
        'beforeShowDay'=>"js:function (date) {
            //alert(date);
			var calendarEvents = $ui;
			var i = 0;
			for (i = 0; i < calendarEvents.length; i++) {
				if ( (date.getMonth() == calendarEvents[i][0] - 1) && (date.getDate() == calendarEvents[i][1]) && (date.getFullYear() == calendarEvents[i][2]) ) {
					//[disable/enable, class for styling appearance, tool tip]
					return [true,'ui-state-active',calendarEvents[i][3]];
				}
			};
			return [true, ''];//enable all other days
		}",
        'onSelect' => "js:function(dateText,inst){
            window.location = '$url'+'?date='+dateText;
        }"
    ),
    'htmlOptions' => array(
        'style'=>'font-size: 9px;'
    ),
));
